package gui;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class AbstractFramePythagoras extends JFrame {
	
	private JPanel panel;
	
	public AbstractFramePythagoras(JPanel panel, String title) {
		this.setSize(panel.getSize());
		this.setTitle(title);
		this.panel = panel;
		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		setLocationRelativeTo(null);
		
		getContentPane().add(panel);
		setVisible(true);
	}
	
	public void changePanel(JPanel newPanel, String title) {
		setTitle(title);
		setSize(newPanel.getSize());
		setContentPane(newPanel);
		this.setLocationRelativeTo(null);
		this.revalidate();
	}

}
